function jsonStringify(target) {
    var type = typeof target;
    if (type !== 'object') {
        if (/string|boolean|number/.test(type)) {
            target = '"' + target + '"';
        }
        else if (/undefined|function|symbol/.test(type)) {
            target = undefined;
        }
        return target;
    }
    else {
        var isArr = Array.isArray(target);
        if (!isArr) {
            var json = [];
            for (var key in target) {
                var value = target[key];
                if (/string|undefined|function/.test(typeof (value))) {
                    value = '"' + value + '"';
                }
                json.push('"' + key + '":' + value);
            }
            return '"{' + String(json) + '}"';
        }
        else {
            var arr = [];
            for (var i = 0; i < target.length; i++) {
                if (/function|undefined|symbol/.test(typeof (target[i]))) {
                    arr.push(null);
                }
                else if (/object/.test(typeof (target[i]))) {
                    var member = String(jsonStringify(target[i]));
                    arr.push(member.substring(1, member.length - 1));
                }
                else if (/string/.test(typeof (target[i]))) {
                    arr.push('"' + target[i] + '"');
                }
                else {
                    arr.push(target[i]);
                }
            }
            return '"[' + String(arr) + ']"';
        }
    }
}
module.exports = jsonStringify;
console.log(jsonStringify('cy'));
console.log(jsonStringify(12));
console.log(jsonStringify(true));
console.log(jsonStringify(undefined));
console.log(jsonStringify(['cy', 18, true, { name: 'cy' }]));
console.log(jsonStringify({ name: 'cy', age: 18, status: true }));
